﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Concurrent;

namespace Fast.Extensions.DatabaseAccessor.EntityFrameworkCore
{
    /// <summary>
    /// 数据库上下文管理器
    /// </summary>
    public interface IDbContextManager
    {
        /// <summary>
        /// 获取所有数据库上下文
        /// </summary>
        /// <returns></returns>
        ConcurrentDictionary<Guid, DbContext> GetDbContexts();
        /// <summary>
        /// 将上下文添加到管理器中
        /// </summary>
        /// <param name="dbContext"></param>
        void AddContext(DbContext dbContext);
        /// <summary>
        /// 关闭数据库上下文连接
        /// </summary>
        void CloseConnection();
    }
}
